package com.leyou.dao;


import com.leyou.pojo.Brand;
import com.leyou.pojo.BrandVo;
import com.leyou.pojo.Category;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface BrandMapper extends Mapper<Brand> {
    @Insert("insert into tb_category_brand values(#{id},#{s})")
    void insertCategory_Brand(Integer id, String s);
   @Select("select c.* from tb_category c inner join tb_category_brand cb where c.id=cb.category_id and #{id}=cb.brand_id")
    List<Category> getCategoryById(Integer id);
    @Select("select b.* from tb_brand b inner join tb_category_brand cb where b.id=cb.brand_id and #{cid}=cb.category_id")
    List<Brand> getBrandByCid(Integer cid);
    @Select("select * from tb_brand where id=#{bid}")
    Brand findBrandById(Integer bid);
}
